package com.leixin.city.${cfg.moduleName}.feign;

import com.github.pagehelper.Page;
import ${package.Entity}.${entity};
import com.leixin.city.${cfg.moduleName}.fallback.${entity}Fallback;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.cloud.openfeign.SpringQueryMap;

/**
 * @Description: TODO
 * @Date : ${date}
 * @Company : TODO
 * @Author : ${author}
 */
@RequestMapping("/${cfg.moduleName}/${table.name}/api")
@FeignClient(value = "city-${cfg.moduleName}", contextId = "${table.name}", fallbackFactory = ${entity}Fallback.class)
public interface ${entity}FeignClient {

    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageSize", paramType = "query", value = "页面大小", required = false),
            @ApiImplicitParam(name = "pageNum", paramType = "query", value = "页码，从1开始", required = false),
            @ApiImplicitParam(name = "orderBy", paramType = "query", value = "排序(实体类属性名 + 排序方式)，eg: id desc, name esc", required = false)
    })
    @ApiOperation(value = "条件查询", notes = "条件查询")
    @GetMapping
    Object getAll(@SpringQueryMap Page<${entity}> p, @SpringQueryMap ${entity} model);

    @GetMapping("{id}")
    @ApiOperation(value = "查询", notes = "根据ID查询", httpMethod = "GET")
    ${entity} getById(@PathVariable("id") String id);

    @PostMapping
    @ApiOperation(value = "保存", notes = "保存", httpMethod = "POST")
    ${entity} save(@RequestBody ${entity} model);

    @PutMapping
    @ApiOperation(value = "更新", notes = "更新", httpMethod = "PUT")
    boolean update(@RequestBody ${entity} model);

    @DeleteMapping("{id}")
    @ApiOperation(value = "删除", notes = "删除", httpMethod = "DELETE")
    int del(@PathVariable("id") String id);

}
